package com.yonyou.pmclouds.async;

import com.alibaba.dubbo.config.annotation.Service;
import com.yonyou.pmclouds.ApplicationConsts;
import com.yonyou.pmclouds.async.entity.BriefAsyncInvocationInfoVO;
import com.yonyou.pmclouds.async.mapper.AsyncInfoMapper;
import com.yonyou.pmclouds.async.rmiitf.AsyncInvocationInfoQuery;
import com.yonyou.pmclouds.basecom.async.AsyncInvocationInfo;
import org.springframework.beans.factory.annotation.Autowired;

@Service(interfaceClass = AsyncInvocationInfoQuery.class, version = ApplicationConsts.APPLICATION_VERSION)
public class AsyncInvocationInfoQueryImpl implements AsyncInvocationInfoQuery, AsyncInfoInnerQuery {
    @Autowired
    private AsyncInfoMapper mapper;

    @Override
    public BriefAsyncInvocationInfoVO queryInfoById(String infoId) {
        AsyncInvocationInfo fullInfo = queryFullInfoById(infoId);
        BriefAsyncInvocationInfoVO info = new BriefAsyncInvocationInfoVO();
        info.setInvocationId(fullInfo.getInvocationId());
        info.setBuzi(fullInfo.getBuzi());
        info.setEndTime(fullInfo.getEndTime());
        info.setExtId(fullInfo.getExtId());
        info.setMsg(fullInfo.getMsg());
        info.setNextId(fullInfo.getNextId());
        info.setSimpleInfo(fullInfo.getSimpleInfo());
        info.setState(fullInfo.getState());
        info.setStateExt(fullInfo.getStateExt());
        info.setSubmitTime(fullInfo.getSubmitTime());
        info.setTenant(fullInfo.getTenantId());
        info.setUser(fullInfo.getUserId());
        return info;
    }

    @Override
    public AsyncInvocationInfo queryFullInfoById(String infoId) {
        return mapper.queryById(infoId);
    }
}
